package hust.game.view;

import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

/**
 * @author Mats Svensson
 */
public class LoadingBar extends Actor {

    Animation animation;
    TextureRegion reg;
    float stateTime;
    float percent;
    
    TextureRegion mRegionTrack;
    TextureRegion mRegionProgress;

    public LoadingBar(Animation animation,TextureRegion track, TextureRegion progress) {
    	this.stateTime = 0;
    	this.percent = 0;
        this.animation = animation;
        this.mRegionTrack = track;
//        this.mRegionProgress = progress;
        this.mRegionProgress = animation.getKeyFrame(stateTime);
//        reg = animation.getKeyFrame(0);
    }

    @Override
    public void act(float delta) {
        stateTime += delta;
        mRegionProgress = animation.getKeyFrame(stateTime);
    }

    @Override
    public void draw(SpriteBatch batch, float parentAlpha) {
    	batch.draw(mRegionTrack, getX(), getY());
    	batch.draw(mRegionProgress,getX(), getY());
//        batch.draw(reg, getX(), getY());
    }
}
